/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MAR.Core;

/**
 *
 * @author Felipe
 */
public class Method implements Member{
    private String name;
    private Class declaringClass;
    private Class[] parameterTypes;
    private Class returnType;

    public Method(String name, Class declaringClass, Class[] parameterTypes, Class returnType ){
        this.name = name;
        this.declaringClass = declaringClass;
        this.parameterTypes = parameterTypes;
        this.returnType = returnType;
    }

    public Class getDeclaringClass(){
        return this.declaringClass;
    }

    public String getName(){
        return this.name;
    }

    public Class[] getParameterTypes(){
        return this.parameterTypes;
    }

    public Class getReturnType(){
        return this.returnType;
    }

    public Object invoke(Reflector reflector, Object[] parameters) throws Exception{
        return reflector.invokeMethod(this.name, parameters);
    }
}
